﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AppendInputTolabel
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnAppend_Click(object sender, EventArgs e)
        {
            lblText.Text = string.Empty;
            List<string> textLines = new List<string>();
            if (Session["textLines"] != null)
            {
                textLines = Session["textLines"] as List<string>;
            }
            textLines.Add(Server.HtmlEncode(txtInput.Text));
            foreach (string line in textLines)
            {
                lblText.Text += line + "<br />";
            }
            Session["textLines"] = textLines;
        }
    }
}